package com.hhp.cloud.shop.admin.component.handler;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.hhp.cloud.shop.admin.pojo.vo.user.LoginUserVO;
import com.hhp.cloud.shop.common.core.result.R;
import lombok.extern.slf4j.Slf4j;

/**
 * @Description: 用户接口降级逻辑
 * @author: hhp
 * @date: 2021/11/30 9:52
 */
@Slf4j
public class UserBlockHandler {
    /**
     * 获取当前登录用户信息的熔断降级处理
     * @param blockException
     * @return
     */
    public static R<LoginUserVO> handleGetCurrentUserBlock(BlockException blockException) {
        return R.ok().setData(new LoginUserVO());
    }

    public static  R handleGetUserByUsernameBlock(String username,BlockException blockException){
        log.info("降级了：{}",username);
        return R.error("降级 了");
    }
}
